package com.conversationboard.fulltext.search.hit;

import java.sql.SQLException;
import java.util.Date;

import org.joda.time.DateTime;

import com.conversationboard.model.Boards;

public class MessageHit implements Comparable<MessageHit> {

	private int boardId;
	private int threadId;
	private int messageId;
	private String threadTitle;
	private String text;
	private String displayName;
	private String loginId;
	private DateTime timestamp;
	private boolean deleted;


	public String getThreadTitle() {
		return threadTitle;
	}


	public void setThreadTitle(String threadTitle) {
		this.threadTitle = threadTitle;
	}


	public boolean isDeleted() {
		return deleted;
	}


	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}


	public String getBoardName() throws SQLException {
		return Boards.getBoard(boardId).getName();
	}


	public int compareTo(MessageHit messageHit) {
		int result = this.timestamp.compareTo(messageHit.timestamp);
		return result;
	}


	public Date getTimestampAsDate() {
		return timestamp.toDate();
	}


	public int getBoardId() {
		return boardId;
	}


	public void setBoardId(int boardId) {
		this.boardId = boardId;
	}


	public int getThreadId() {
		return threadId;
	}


	public void setThreadId(int threadId) {
		this.threadId = threadId;
	}


	public int getMessageId() {
		return messageId;
	}


	public void setMessageId(int messageId) {
		this.messageId = messageId;
	}


	public String getText() {
		return text;
	}


	public void setText(String text) {
		this.text = text;
	}


	public String getDisplayName() {
		return displayName;
	}


	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}


	public String getLoginId() {
		return loginId;
	}


	public void setLoginId(String loginId) {
		this.loginId = loginId;
	}


	public DateTime getTimestamp() {
		return timestamp;
	}


	public void setTimestamp(DateTime timestamp) {
		this.timestamp = timestamp;
	}

}
